package com.pgp.demo.pgpexample.exception;
import lombok.Getter;
import lombok.NoArgsConstructor;
import lombok.Setter;
/**
 * 基地例外
 *
 * @author Alan
 * @date 2022/11/29
 */
@Getter
@Setter
@NoArgsConstructor
public abstract class BaseException extends RuntimeException {
    /**
     * 代码 返回用户
     */
    private String code = "500";
    /**
     * 消息 返回用户
     */
    private String message = "Internal Server Error";
    /**
     * 详细信息 (内部调试)
     */
    private String detailMessage;

    protected BaseException(String message) {
        this.message = message;
    }

    protected BaseException(String code, String message) {
        this(message);
        this.code = code;
    }

    /**
     * 重写此方法，直接返回，避免调用本地方法爬堆栈信息提高性能
     *
     * @return {@link Throwable}
     */
    @Override
    public synchronized Throwable fillInStackTrace() {
        return this;
    }
}
